<template>
  <div>
    <div class="login_input">
      <div class="username_input">
        <img src="../../../assets/img/login/ic_username.png" alt="">
        <van-field 
          v-model="username"
          class="field_input" 
          placeholder="请输入Email或小写字母开头6-18位用户名"
          maxlength="18"/>
      </div>
      <div class="password_input">
        <img src="../../../assets/img/login/bt_login_lock.png" alt="">
        <van-field 
          :type="type"
          v-model="password"
          class="field_input" 
          placeholder="请输入6-18位登陆密码"
          maxlength="18"/>
        <div class="password_eyes" @click="typeClick">
          <img v-if="!typeShow" src="../../../assets/img/login/bt_login_eye.png" alt="">
          <img v-else src="../../../assets/img/login/bt_login_eye_open.png" alt="">
        </div>  
      </div>
      <van-button round class="login_btn">立即登录</van-button>
      <div class="forget" @click="$router.push('/login/forget_password')">忘记密码</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
      typeShow: false,
      type: 'password',
    }
  },
  methods: {
    typeClick() {
      if (!this.typeShow) {
        this.typeShow = !this.typeShow
        this.type = 'text'
      }else {
        this.typeShow = !this.typeShow
        this.type = 'password'
      }
    }
  },
}
</script>

<style lang="less" scoped>
.login_input {
  box-sizing: border-box;
  width: 100%;
  height: 6.613333rem;
  padding: .266667rem .666667rem 1.333333rem;
  .username_input {
    display: flex;
    align-items: center;
    img {
      width: .506667rem;
      height: .506667rem;
      margin-right: .333333rem;
    }
    .field_input {
      padding: 0;
      height: 1.173333rem;
      line-height: 1.173333rem;
      font-size: .32rem;
      border-bottom: 1px solid #dddddd;
    }
  }
  .password_input {
    position: relative;
    margin-top: .426667rem;
    display: flex;
    align-items: center;
    img {
      width: .506667rem;
      height: .506667rem;
      margin-right: .333333rem;
    }
    .field_input {
      padding: 0;
      height: 1.173333rem;
      line-height: 1.173333rem;
      font-size: .32rem;
      border-bottom: 1px solid #dddddd;
    }
    .password_eyes {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      width: .506667rem;
      height: .506667rem;
      img {
        display: block;
        width: .506667rem;
        height: .506667rem;
      }
    }
  }
}

.login_btn {
  width: 7.813333rem;
  height: 1.173333rem;
  background: linear-gradient(-30deg, #FF5543, #FF7438);
  border-radius: .586667rem;
  margin-top: .533333rem;
  font-size: .4rem;
  color: #fff;
  font-weight: 500;
}

.forget {
  text-align: right;
  padding-top: .2rem;
  font-size: .346667rem;
  font-weight: 500;
  color: #5361FE;
}


</style>